package com.edu.controller;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class MyController {

    @RequestMapping("/test01")
    public String test01(@RequestParam int stuId){
        System.out.println("执行了test01");
        return "/index.jsp";
    }


    @RequestMapping("/test02")
    public String test02(){
        System.out.println("执行了test02");
        String str = null;
        System.out.println(str.length());
        return "/index.jsp";
    }

//    @ExceptionHandler(Throwable.class)
//    public ModelAndView exceptionHandler(){
//        ModelAndView mv = new ModelAndView();
//        System.out.println("1");
//        mv.addObject("msg","出错啦~");
//        mv.setViewName("forward:/error.jsp");
//        return mv;
//    }
//
//    @ExceptionHandler(NullPointerException.class)
//    public ModelAndView exceptionHandler2(){
//        ModelAndView mv = new ModelAndView();
//        mv.addObject("msg","低级错误，检查空指针问题");
//        mv.setViewName("forward:/error.jsp");
//        return mv;
//    }

}
